UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hxF4cAHSunEgTGdZgAOkDKJYjKaNZKpdPoy8yFM6qpc=' 
WHERE 
  key_id = 'c50b2c076d9d98066b6135866193e4b8c7ee907ed7f6224940b77bb11d3c84bb' 
  AND (
    token = 'hxF4cAHSunEgTGdZgAOkDKJYjKaNZKpdPoy8yFM6qpc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026