UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9XLJ46vid3rALBeQcRPPbFSefxIKxgG+mZRT4VjSE38=' 
WHERE 
  key_id = '6473528ca960761b4e3fd9b8acb04fdf90b465ae5a8eb83ad25b26b9746a30b5' 
  AND (
    token = '9XLJ46vid3rALBeQcRPPbFSefxIKxgG+mZRT4VjSE38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035