UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7p0ZuzwWQtOMDDdl9NNIbcIlRimJMXpNwaLSJGac8H8=' 
WHERE 
  key_id = '49a42cc1a5d06c07c83c7ceb77ee62201b0cf270fb930dfab929bfdfbe885217' 
  AND (
    token = '7p0ZuzwWQtOMDDdl9NNIbcIlRimJMXpNwaLSJGac8H8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038