UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9AlmRZflnyw1eI4E6VagSe3Ok7RuXCy6AASZXg29UFc='
WHERE
key_id = '3403dff81a01599b63b47670c8500cce775d185c72487a6033d76d93922917ea'
AND (
token = '9AlmRZflnyw1eI4E6VagSe3Ok7RuXCy6AASZXg29UFc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)