UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CSVWV//Fk4y1rGRzN0+Bu5bSolNzFcFPa8SFRQOoXkg=' 
WHERE 
  key_id = '169f6700cf8303ca86be8788a20727a8402266c9321483d74935f7dd11b9a813' 
  AND (
    token = 'CSVWV//Fk4y1rGRzN0+Bu5bSolNzFcFPa8SFRQOoXkg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025