UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8ZS2IRUxA+9WgkuQdUx0GdgqbVcxA2/6K0AzswboyPQ='
WHERE
key_id = 'f1411c3045635d3f233ef7cfbbc329470f6357dd069165b4cd65e3f068a3e57d'
AND (
token = '8ZS2IRUxA+9WgkuQdUx0GdgqbVcxA2/6K0AzswboyPQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)