UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YSIUDx/01sTPiaTGfprMUOLAbBfrwoTsJx4shqiXE0M='
WHERE
key_id = 'c433130dfc6fadbc258810334014ae504fcae437f07ec79da34e327360d3819a'
AND (
token = 'YSIUDx/01sTPiaTGfprMUOLAbBfrwoTsJx4shqiXE0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)