UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n8BC+W0hO8umDwGTOEhJEHquntN/NtSwHukl0M/G+xY=' 
WHERE 
  key_id = '2ec28192a3d2bec3e4e55dfcbd78aa37ff557a8d547a205b13cb49b0a04f00f1' 
  AND (
    token = 'n8BC+W0hO8umDwGTOEhJEHquntN/NtSwHukl0M/G+xY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022