UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mUEapv3mJUn04D6U18kHl5RJawHMQ+/QEqDGiHzxoW8=' 
WHERE 
  key_id = '45e82bc45c90e34a935ae0c19567b6dd587548e27468daa49300b858f75f01e1' 
  AND (
    token = 'mUEapv3mJUn04D6U18kHl5RJawHMQ+/QEqDGiHzxoW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044