UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WS7IiOwQiAhiA5FNL/oLJJ3Ot+nCqY2hAXXOha6f5CI=' 
WHERE 
  key_id = '1671922294bfa61dae317cedcef7962c429f36da52d2d3f47123b7e3329b0133' 
  AND (
    token = 'WS7IiOwQiAhiA5FNL/oLJJ3Ot+nCqY2hAXXOha6f5CI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027