UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zQdnHKsIk44MMpy7qqEO8PUlMGy6+wpUFxDptCmPXQI='
WHERE
key_id = '50f7948d7e12a25608416bdbe15d1c11e9912bc752c7215ed3b7e5e1b3a242d3'
AND (
token = 'zQdnHKsIk44MMpy7qqEO8PUlMGy6+wpUFxDptCmPXQI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)