UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l7lMlo/bTqS8p+osV+I0QxyEc11MQ7bVOwvpLN+pDhs=' 
WHERE 
  key_id = 'c6ce6027f150ef84cee01e1d00175fab9ce2019b80010321cd628e1538a6bc36' 
  AND (
    token = 'l7lMlo/bTqS8p+osV+I0QxyEc11MQ7bVOwvpLN+pDhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025