UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5zqOZn+5UoJY8xaJQIizeuIVfwISwNFEAOM457ekbCY='
WHERE
key_id = '012293a429259c7bd8870cb0cfe11fc92a1a88a42951279d62b90cb683172bfb'
AND (
token = '5zqOZn+5UoJY8xaJQIizeuIVfwISwNFEAOM457ekbCY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)