UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PXw8CtiivLhxAntK2Y+RXCrbEng8FaVBdkCnZjlLn40='
WHERE
key_id = '8aa2e4af17d96c789ee2f4ce67a476ada35f294aa737e56e9a4742984e0aecad'
AND (
token = 'PXw8CtiivLhxAntK2Y+RXCrbEng8FaVBdkCnZjlLn40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)