UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BlyVLXzeVNcOeeIsN88tIK5BmTlQ81vXYSHZSyW3YYw='
WHERE
key_id = 'a8e5c15baccf52af0b9ea867f646765bbd1b543c1b24cccac425e924a9af20ae'
AND (
token = 'BlyVLXzeVNcOeeIsN88tIK5BmTlQ81vXYSHZSyW3YYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)