UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SPuTqMp5bAd6A9T5a6uBFNeAwY0zsCQZ6+2yTrbDHEk='
WHERE
key_id = '5765673e34913e9d2362bf956899a2f27f2290ac8c0116ef4704c07fb5d45641'
AND (
token = 'SPuTqMp5bAd6A9T5a6uBFNeAwY0zsCQZ6+2yTrbDHEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)