UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8eAx2ewExBV5L7PlwYIBs4H4zqBHraW0DmIHHCopzzs='
WHERE
key_id = '4b7117f93f97c1d559b76dfceaac8d7a8db09accfbba4e13d372196f5c4ffe17'
AND (
token = '8eAx2ewExBV5L7PlwYIBs4H4zqBHraW0DmIHHCopzzs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)