UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y+eOypAML8CW92WunGvZOxn1vPq5WNg5nj7zL6TCMLA=' 
WHERE 
  key_id = 'ac3d1e99b313a0aa674064a08d0261f4d8127493f41c2b769853eb8a370fe17c' 
  AND (
    token = 'Y+eOypAML8CW92WunGvZOxn1vPq5WNg5nj7zL6TCMLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061