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