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