UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hFUuPwDmBTz3XNe1k+8+PD7L7G81ErHPX1P/2XMdudU='
WHERE
key_id = '4a409588e5a65eab8e3578bb0b515e3cebd77573e3167b65877f1fe032063bae'
AND (
token = 'hFUuPwDmBTz3XNe1k+8+PD7L7G81ErHPX1P/2XMdudU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)