UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gyb8NeJ1IueXSXv8vpP8TUihH6+RellLLIAZqw1qMTs=' 
WHERE 
  key_id = '41c4be1b7f517fd52aa8152121af8e96e51394d701c3f8a1ec8709304bb4851c' 
  AND (
    token = 'gyb8NeJ1IueXSXv8vpP8TUihH6+RellLLIAZqw1qMTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040