UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v1TRe2CV8+64qyGEYhk5ZCpB8W575ccDAD+eUTmrTag='
WHERE
key_id = '515c0b72b5541db033bdc84c247a4b7484dc478ce0226f5078e053a3b0d79f76'
AND (
token = 'v1TRe2CV8+64qyGEYhk5ZCpB8W575ccDAD+eUTmrTag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)