UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dHmzddWH8ttdVugafBbuFrfD4B8bI9z2Cmu+uCfMohY=' 
WHERE 
  key_id = '5a6f6b4e62bbfca193718609788f3e05d52510501d2a58ddabed8c0393dada0f' 
  AND (
    token = 'dHmzddWH8ttdVugafBbuFrfD4B8bI9z2Cmu+uCfMohY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047