UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+1J2wa1+hRksb3v4FCehAvSwOWJE0NGkEZwDwIWAnMU=' 
WHERE 
  key_id = 'ff5ef012e1314a59a1a90f13720634bd0f4e40e0dba0a2822eb837af2b2568c4' 
  AND (
    token = '+1J2wa1+hRksb3v4FCehAvSwOWJE0NGkEZwDwIWAnMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020