UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'At78hM5g0Qb1wcBV2EviN+lAqWmTSGKiAvB7iU8fO8M=' 
WHERE 
  key_id = '5900586cf24241078b6efeb103147ed704318046351844690f66460949c27d3a' 
  AND (
    token = 'At78hM5g0Qb1wcBV2EviN+lAqWmTSGKiAvB7iU8fO8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049