UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ubs1lzcPPUYsEHLiS2Kc9F9WXlTzsrbjZofqOuLuyCc=' 
WHERE 
  key_id = '1b328a30e9667d638e33c6c3e77a8d37f7067a40bf307244f1743ec408d17d6a' 
  AND (
    token = 'ubs1lzcPPUYsEHLiS2Kc9F9WXlTzsrbjZofqOuLuyCc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029