UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zL5HG56Sst4wNkvIs1HtuAJemKALWcP4SoWdTJMI8y4=' 
WHERE 
  key_id = '71066604af0d06ffc4d98a1b83c4220d5f3357bed81be791426a35f394384922' 
  AND (
    token = 'zL5HG56Sst4wNkvIs1HtuAJemKALWcP4SoWdTJMI8y4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041