UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NO6gf3RZP6xzpvJ9kXs8l814GZynjo/s4r/WTjtemcc=' 
WHERE 
  key_id = '76ea964f19befce954690e29a44f95dbeb0fad6fdad4aff55e55af264a8f30db' 
  AND (
    token = 'NO6gf3RZP6xzpvJ9kXs8l814GZynjo/s4r/WTjtemcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022