UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nnI4q2OONhdpo+Uu3c6NoNpdwZvHn7TWBCXOzQdTo4g=' 
WHERE 
  key_id = '580199cc185574e085058ca99c01d94c75264345f8cc27a57a573cccefb98bd7' 
  AND (
    token = 'nnI4q2OONhdpo+Uu3c6NoNpdwZvHn7TWBCXOzQdTo4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055