UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hlmAHq8IGgVFpXNnCqbmBKR47OGBwejAS2DKtFOadUw='
WHERE
key_id = 'a0996c04c26278d0205248751078a05df526a17c8a22f6ea8b28b9ac2f2b38dc'
AND (
token = 'hlmAHq8IGgVFpXNnCqbmBKR47OGBwejAS2DKtFOadUw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)