UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lLuxzIaFy9qHOavs+K7alFhptu74tAGJ723hxfKnqm8=' 
WHERE 
  key_id = '9ca937c3faeb63ecfe2b98e80ae44b5e256b3e2b2c4a05073292418effed6a49' 
  AND (
    token = 'lLuxzIaFy9qHOavs+K7alFhptu74tAGJ723hxfKnqm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030