UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '385hPvM+BF2l2ZImMpFt3S3txfqbEsCJHo0LKuUeuuw='
WHERE
key_id = '62f471f4b2f9bbbe477dae51789877ec12c86101afcc7c5ce723189f5d3b163b'
AND (
token = '385hPvM+BF2l2ZImMpFt3S3txfqbEsCJHo0LKuUeuuw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)