UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aCM9DCrX4eo1SszzP/882dvqhmMXPG2O33nShk1eW3A=' 
WHERE 
  key_id = '8cb4fa21fe7af5af19bebfd65747ad4b3dfc74dd0580700566c25f842da0c238' 
  AND (
    token = 'aCM9DCrX4eo1SszzP/882dvqhmMXPG2O33nShk1eW3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048