UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cG7QuRHeAdWWqPQq1WX3z02NSDdqE5JrK2BzC9tIyCY='
WHERE
key_id = '77fd7b87585d7f4655980056af70b98ec4c620a4c8e5d5b35fcb63221053e1d1'
AND (
token = 'cG7QuRHeAdWWqPQq1WX3z02NSDdqE5JrK2BzC9tIyCY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)