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