UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6n0iN69ZjtduV9+BJiAM0oFHTWbkSnMJ90yL4rA6acI='
WHERE
key_id = 'e8516176a9f04e3cbd3452bee387fbc32e39ef7d75e2a1b209aae9fcd2fb1e00'
AND (
token = '6n0iN69ZjtduV9+BJiAM0oFHTWbkSnMJ90yL4rA6acI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)