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