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