UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r4017A5rVJShBGxn8T01iiJNeEdQ5P/8eS7QA2lP3vw='
WHERE
key_id = 'c727d04e8639aceeb02afa93ceedce395f132a8a8ed94ce64e8dcb97798a6e36'
AND (
token = 'r4017A5rVJShBGxn8T01iiJNeEdQ5P/8eS7QA2lP3vw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)