UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hAFep+IEp6tSmnUIFFE3hxqJYSo2P0gzLwOQjyEqhYs='
WHERE
key_id = '407e06bedf2205644ae2b62597d6ea18e42f7c0da41207e3af515057e16a6bd8'
AND (
token = 'hAFep+IEp6tSmnUIFFE3hxqJYSo2P0gzLwOQjyEqhYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)