UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BTnJpVwHTrpvUwCfNCj9f+eMylvezYvrlhlOD3LnpHc='
WHERE
key_id = 'a77a3a4060931ab8b8b381a6a0d8de9caf227ace69002b43b6d11d7f0ad2587c'
AND (
token = 'BTnJpVwHTrpvUwCfNCj9f+eMylvezYvrlhlOD3LnpHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)