UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M8nWRM66O5melRoUzFkyNiPHpESao7t/DQmvXZ0AQsA=' 
WHERE 
  key_id = 'e5b35485e471a386a9ca3afebd56951f45424345087575309d67b5d36f77fd6e' 
  AND (
    token = 'M8nWRM66O5melRoUzFkyNiPHpESao7t/DQmvXZ0AQsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032